﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Kristall.Engine;

namespace Kristall.Editor.Commands
{
    public class MoveCommand : ICommand
    {
        AABB _toMove;
        Vector2 _newPosition = Vector2.Zero;
        Vector2 _oldPosition;

        public MoveCommand(AABB toMove, Vector2 newPosition)
        {
            _toMove = toMove;
            _newPosition.X = (int)newPosition.X;
            _newPosition.Y = (int)newPosition.Y;
            _oldPosition = _toMove.Position;
        }

        public bool Execute()
        {
            _toMove.Position = _newPosition;
            return true;
        }

        public bool Undo()
        {
            _toMove.Position = _oldPosition;
            return true;
        }

        public string Name
        {
            get { return "Move"; }
        }
    }
}
